package model
{
	import flash.display.DisplayObject;
	import flash.utils.setTimeout;
	public class Shake
	{
		public function Shake()
		{					
			
		}
		/**
		 * mc要抖动的对象
		 * @extent抖动幅度(像素)Number
		 * @speed抖动速度 (秒)Number
		 * @param mc 需要DisplayObject
		 * @param extent
		 * 
		 */		
		public static function ShakeObject(mc:DisplayObject,extent:Number,speed:Number):void
		{
			
			var arr:Array = [function():void{mc.y -= extent/2;},function():void{mc.x += extent/2;},function():void{mc.y += extent;},function():void{mc.x -= extent;},function():void{mc.y -= extent;},function():void{mc.x += extent/2;},function():void{mc.y += extent/2;}];						
				
			for(var i:uint=0; i<arr.length; i++){
				setTimeout(arr[i],speed / arr.length * (i+1) * 1000)
			}
						
							
								
									
		}
	}
}